/*************************************************************************
 *************************************************************************
 	 	 	 	 	 	 	 M2SMA : Agent.h
 *************************************************************************
 *
 	 Copyright (C) 2008
 	 Steven Costiou, Julien Yven; Master 2 Complex Systems
 	 University of Western Brittany (UBO), Brest, France
 *
 *************************************************************************
 *************************************************************************
 *
 	 Copyright (C) 2011
 	 M2SMA reworked and simplified core, Steven Costiou, France
 *
 **************************************************************************
 **************************************************************************
 *
 	 An Agent is the elementary entity able to live and work on an environ-
 	 ment. This super agent has no special abilities or functions.
 *
 **************************************************************************
 **************************************************************************
 *
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/
 *
 **************************************************************************
 **************************************************************************/



#ifndef AGENT_H
#define AGENT_H

#include <string>
#include <vector>
#include <map>
#include <iostream>
#include <sstream>

#include "COMMON_LIBS.h"

using namespace std;

class Engine;

class Agent
{
    public:

			Agent();
	 		Agent(Engine* anEngine);
	 		~Agent();
	        Agent(const Agent& anAgent, Engine* anEngine);

	        friend ostream& operator<<(ostream& os, const Agent& anAgent);
			Agent& operator=(const Agent& anAgent);
			friend bool operator==(const Agent& anAgent1, const Agent& anAgent2);
			friend bool operator!=(const Agent& anAgent1, const Agent& anAgent2);

			void setName(string aName) { this->name = aName; };
			string getName() { return this->name; };

			vector<string>* getClassNames() { return this->fullClassNameHierarchy; };
			string getClassName() { return this->fullClassNameHierarchy->back();}
			string getFullClassName();

			virtual void live();

			/// TODO isKindOf(const char* aAgentClass) to implement


    protected:

			virtual void selfCopyFrom(const Agent& anAgent, Engine* anEngine);

			virtual void display();
			virtual bool isEqualTo(const Agent& anAgent) const;

			void addClassName(string aClassName);

			void stopSystem();

			void setParentEngine(Engine* anEngine) { this->parentEngine = anEngine; };
			Engine* getParentEngine() { return this->parentEngine; };

    private:

			string name;
			string fullClassName;
			vector<string>* fullClassNameHierarchy;
			Engine* parentEngine;
};

#endif /** AGENT_H **/
